﻿<%@ Page Title="Fare Authorization" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="FareOffices.aspx.cs" Inherits="IFD2.FareOffices" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <form id="form1" runat="server" role="form" class="form-inline" defaultbutton="lbtnQuery">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
    <div class="container-fluid body-content" style="width:100%;">

    <div class="row">
        <div class="col-sm-2 well well-sm">
            <h5><asp:Literal ID="litTitle" runat="server" meta:resourcekey="tipPageTitle"></asp:Literal></h5>
            <div class="form-group">
                <asp:Label ID="Label6" runat="server" Text="Airline:" Visible="false"></asp:Label>
                <asp:Label ID="lblFareAirline" runat="server" Font-Bold="true" Visible="false"></asp:Label><br />
                <asp:Label ID="Label2" runat="server" Font-Bold="False" Text="Fare Code:" meta:resourcekey="FareCode"></asp:Label>
                <asp:Label ID="lblFareCode" runat="server" Font-Bold="true"></asp:Label>
            </div>
            <br class="hidden-xs"/><br class="hidden-xs"/>
            <asp:LinkButton ID="lbtnQuery" runat="server" CssClass="form-control input-sm btn-primary text-center" Width="100%" ToolTip="" meta:resourcekey="tipQuery" OnClick="lbtnQuery_Click"> <span class="glyphicon glyphicon-search" style="font-size:large;"></span></asp:LinkButton>
            <p></p><%--没有此行(或&nbsp;)，上面的按钮在手机模式(xs)下，只有上半部可以点击！--%>
            <asp:HiddenField ID="hidFareCode" runat="server" />
            <asp:HiddenField ID="hidFareAirline" runat="server" />
        </div>

        <div class="col-sm-10 well well-sm">
            <div class="panel">
                <div class="panel-heading btn-primary">
                    <h6 class="panel-title" id="section-2"><asp:Literal ID="Literal1" runat="server" meta:resourcekey="Authorized"></asp:Literal></h6>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" style="min-width:500px;width:80%;" class="table-hover"
                            DataSourceID="SqlDataSource3" ForeColor="#333333" GridLines="None">
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                    <input name="KEY" type="radio" value='<%# Eval("auth_airline")+"|"+Eval("auth_office") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="auth_airline" HeaderText="auth_airline" SortExpression="auth_airline"  meta:resourcekey="airline1" />
                                <asp:BoundField DataField="auth_office" HeaderText="auth_office" SortExpression="auth_office"  meta:resourcekey="auth_office" />
                                <asp:BoundField DataField="done_user" HeaderText="done_user" SortExpression="done_user"  meta:resourcekey="done_user" />
                                <asp:BoundField DataField="done_time" HeaderText="done_time" SortExpression="done_time"  meta:resourcekey="done_time" />
                            </Columns>
                            <RowStyle BackColor="#EFF3FB" />
                            <EditRowStyle BackColor="#2461BF" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>

                        <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                            SelectCommand="bll_fare_get_authorized_offices" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                            <SelectParameters>
                                <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                                <asp:ControlParameter ControlID="hidFareCode" Name="fare" PropertyName="Value" Type="String" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>
                    <asp:Button ID="butDelete" runat="server" Text="Delete" OnClick="butDelete_Click"  meta:resourcekey="Delete" CssClass="btn btn-sm btn-default" /><br />
                    <asp:Label ID="lblError" runat="server" CssClass="ifdMessage"></asp:Label>
                    <div class="well well-sm">
                        <div class="form-group">
                        <asp:Label ID="Label3" runat="server" meta:resourcekey="Airline" Text="Airline:"></asp:Label>
                        <asp:DropDownList ID="lstAirline" runat="server" DataSourceID="SqlDataSource1" 
                            DataTextField="code" DataValueField="code" 
                            OnSelectedIndexChanged="lstAirline_SelectedIndexChanged" Width="125px">
                        </asp:DropDownList>
                        </div>
                        <div class="form-group">
                        <asp:Label ID="Label5" runat="server" Text="Office Type:" meta:resourcekey="OfficeType"></asp:Label>
                        &nbsp;<asp:DropDownList ID="lstOfficeTypes" runat="server">
                            <asp:ListItem Value="SAL" meta:resourcekey="SalesDept">Sales Dept.</asp:ListItem>
                            <asp:ListItem Value="INV" meta:resourcekey="InventoryDept">Inventory Dept.</asp:ListItem>
                            <asp:ListItem Value="AGT" Selected="True" meta:resourcekey="Agents">Own Agents</asp:ListItem>
                            <asp:ListItem Value="CLI" meta:resourcekey="Clients">Big Clients</asp:ListItem>
                            <asp:ListItem Value="COR" meta:resourcekey="CoreDept">Core Dept.</asp:ListItem>
                            <asp:ListItem Value="NET" meta:resourcekey="NetworkDept">Network Dept.</asp:ListItem>
                            <asp:ListItem Value="FAR" meta:resourcekey="FareDept">Fare Dept.</asp:ListItem>
                            <asp:ListItem Value="DEP" meta:resourcekey="DepartureDept">Departure Dept.</asp:ListItem>
                        </asp:DropDownList>
                        </div>
                        <div class="form-group">
                        <asp:Label ID="Label4" runat="server" Text="Office Rank:" meta:resourcekey="OfficeRank"></asp:Label>
                        <asp:TextBox ID="txtRank" runat="server" MaxLength="2" Width="27px"></asp:TextBox>
                        </div>
                        <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="Search" meta:resourcekey="Search" CssClass="btn btn-sm btn-default" /><br />
                        <asp:ListBox ID="lstAvailOffices" runat="server" Height="215px" Width="211px" 
                            DataSourceID="SqlDataSource2" DataTextField="id" DataValueField="id" 
                            SelectionMode="Multiple" ondatabound="lstAvailOffices_DataBound">
                        </asp:ListBox><br />
                        <asp:Button ID="butAdd" runat="server" Text="Add" OnClick="butAdd_Click" CssClass="btn btn-sm btn-default" meta:resourcekey="Add" />

                        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                            SelectCommand="bll_fare_get_unauthorized_offices" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                            <SelectParameters>
                                <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                                <asp:ControlParameter ControlID="hidFareCode" Name="fare_code" PropertyName="Value" Type="String" />
                                <asp:ControlParameter ControlID="lstAirline" Name="auth_airline" PropertyName="SelectedValue" Type="String" />
                                <asp:ControlParameter ControlID="lstOfficeTypes" Name="office_type" PropertyName="SelectedValue" Type="String" />
                                <asp:ControlParameter ControlID="txtRank" Name="rank" PropertyName="Text" Type="String" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                            SelectCommand="bll_airline_get_codes" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                        </asp:SqlDataSource>
                    </div>
                </div>
            </div>
        </div>
    </div>

    </div>
    </ContentTemplate></asp:UpdatePanel>
    </form>

</asp:Content>
